//
//  NYMyVipPrivilegeCell.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/9.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYMyVipPrivilegeCell.h"
@interface NYMyVipPrivilegeCell ()
@end
@implementation NYMyVipPrivilegeCell
+ (CGFloat)heightForObject:(id)object identifier:(NSString *)identifier atIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView
{
        return __WGHeight(169);
}
- (void)setupView
{
        [super setupView];
        TTTAttributedLabel *titleLabel = [[TTTAttributedLabel alloc] initWithFont:WGSystem16Font textColor:UIColorHex(0x333333)];
        titleLabel.text = @"牛娃会员特权";
        [self.contentView addSubview:titleLabel];
        
        QMUIButton *button1 = [self createButtonWithImage:[UIImage guan_kan_quan_bu_ke_cheng] title:@"观看全部课程"];
        QMUIButton *button2 = [self createButtonWithImage:[UIImage zai_xian_kao_shi] title:@"在线考试"];
        QMUIButton *button3 = [self createButtonWithImage:[UIImage zai_xian_da_yi] title:@"在线答疑"];
        UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[button1,button2,button3]];
        stackView.axis = UILayoutConstraintAxisHorizontal;
        stackView.distribution = UIStackViewDistributionFillEqually;
        stackView.alignment = UIStackViewAlignmentFill;
        stackView.spacing = 0;
        [self.contentView addSubview:stackView];
        
        [titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.contentView).offset(__WGHeight(20));
                make.left.equalTo(self.contentView).offset(__WGWidth(15));
                make.right.equalTo(self.contentView).offset(-__WGWidth(15));
                make.height.mas_equalTo(20);
        }];
        
        [stackView mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(titleLabel.mas_bottom).offset(__WGHeight(20));
                make.left.right.equalTo(self.contentView);
                make.bottom.equalTo(self.contentView.mas_bottom).offset(-__WGHeight(32));
        }];
}

- (QMUIButton *)createButtonWithImage:(UIImage *)image title:(NSString *)title
{
        QMUIButton *button = [[QMUIButton alloc] qmui_initWithImage:image title:title];
        button.imagePosition = QMUIButtonImagePositionTop;
        button.spacingBetweenImageAndTitle = __WGHeight(15);
        [button setTitleColor:UIColorHex(0x333333) forState:(UIControlStateNormal)];
        button.titleLabel.font = WGSystem14Font;
        button.titleLabel.textAlignment = NSTextAlignmentCenter;
        return button;
}
@end
